package com.sk.gzwater.adapter;

import java.util.List;

import com.sk.gzewop.R;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ListView;
import android.widget.TextView;

public class ListviewAdapterSplit extends BaseAdapter {
	private Context context;
	private List<String> data;
	private List<String> split;
	public ListviewAdapterSplit(Context context,List<String> data,List<String> split ){
		this.context = context;
		this.data = data;
		this.split = split;
	}

	@Override
	public int getCount() {
		// TODO Auto-generated method stub
		return data.size();
	}

	@Override
	public Object getItem(int position) {
		// TODO Auto-generated method stub
		return data.get(position);
	}

	@Override
	public long getItemId(int position) {
		// TODO Auto-generated method stub
		return position;
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		View view = convertView;
		if(split.contains(getItem(position))){
			view = LayoutInflater.from(context).inflate(R.layout.shuichanglist_split, null);
			((TextView)view.findViewById(R.id.shuichanglist_split)).setText(getItem(position).toString());
		}else {
			view = LayoutInflater.from(context).inflate(R.layout.shuichanglist_item, null);
			((TextView)view.findViewById(R.id.shuichang_name)).setText(getItem(position).toString());
		}
		return view;
	}
	public boolean isEnabled(int position) {
		// TODO Auto-generated method stub
		if(split.contains(getItem(position))){
			return false;
		}
		return super.isEnabled(position);
	}
}
